<template>
	<view class="jianli">
		<uni-nav-bar shadow left-icon="left" @clickLeft="back" />
		<view class="content-card" v-for="(item,index) in list" :key="index">
			<uni-card :title="item.xsname" spacing="0 20%" :thumbnail="item.xsimg">
				<view>性别：{{item.sex}}</view>
				<view>联系方式：{{item.phone}}</view>
			</uni-card>
			<view class="main-card">
				<view class="title">个人描述</view>
				<view class="title-main">
					<rich-text :nodes="item.description"></rich-text>
				</view>
				<view class="title">技术能力</view>
				<view class="title-main">
					<rich-text :nodes="item.skill"></rich-text>
				</view>
			</view>

			<view class="bt" v-if="item.zt == '抉择'">
				<button type="primary" @tap="pass(item.id)">通过</button>
				<button class="btbg" type="primary" @tap="refuse(item.id)">拒绝</button>
			</view>
		</view>
	</view>
</template>

<script>
	import axios from "axios"
	export default {
		data() {
			return {
				id: '',
				list: [{}],
				// list: [{
				// 	id: 1,
				// 	img:'/static/img/2.svg',
				// 	name: "inb",
				// 	sex: '男',
				// 	phone: '13244445555',
				// 	description: '有很强的学习能力性格友好，助人为乐',
				// 	skill: '熟练office操作初级会计资格证书',
				// 	zt: '抉择',
				// }],

			}
		},
		onLoad(data) {
			this.id = data.id
		},
		mounted() {
			const id = this.id
			axios.get('/api/shenqingdetails?id=' + id).then(res => {
				// console.log(res.data);
				this.list = res.data
			})
		},
		methods: {
			back() {
				uni.switchTab({
					url: '/pages/message/message'
				})
			},
			gomyfrom() {
				uni.navigateTo({
					url: '/pages/my/myform/myform'
				})
			},
			pass(id) {
				axios.post('/api/pass?id=' + id).then(res => {

					uni.showToast({
						title: '通过',
						mask:true
					})
				}).then(res => {
					this.$router.go(0)
				}).catch(res =>{
					uni.showToast({
						title: '请求失败',
						icon: "error",
						mask:true
					})
				})
			},
			refuse(id) {
				axios.post('/api/refuse?id=' + id).then(res => {


					uni.showToast({
						title: '拒绝成功',
						mask:true
					})
				}).then(res => {
					this.$router.go(0)
				}).catch(res =>{
					uni.showToast({
						title: '请求失败',
						icon: "error",
						mask:true
					})
				})
			}

		},
	}
</script>
<style scoped lang="scss">
	.jianli {
		width: 100%;
		height: 100%;
		// padding: 0 10%;
	}

	.main-card {
		width: 100%;
		height: 100%;
		padding: 0 10%;

		.title {
			width: 100%;
			height: 100%;
			color: #99CCCC;
			font-size: 50rpx;
			font-weight: bold;
		}

		.title-main {
			height: 100%;
			padding: 40rpx 0;
		}

	}

	text {
		margin: 0 5px;
	}

	.bt {
		width: 100%;
		padding-top: 5%;
		display: flex;
		justify-content: space-between;
	}

	.btbg {

		background-color: #99CCCC;
	}

	button {
		width: 40%;
	}
</style>
